<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/style.css" />
		<script src="../js/jquery-1.8.0.min.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/head_public.js"></script>
		
		<script src="../js/common.js"></script>
		<style>
			.yirenzheng{background:#ff7e00;border-radius: 0.5rem;border: none!important;color: #fff!important;margin-top: 0.8rem;}
		    .gengxin{font-size: 0.3rem;color: #666;margin-top: 0.8rem;display: inline-block;margin-left: 0.5rem;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav ding-bar">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">商品列表</h1>
		</header>
		<div class="mui-content" style="padding-bottom: 0px;">
	    	<ul class="store-list">
	    		<!--<li>
	    			<a data-href="">
	    				<img  src="../images/goods.png"/>
	    				<div class="store-con">
	    					<h1 class="only-line">兰州新辉商店</h1>
	    					<button class="yirenzheng">已认证</button><span class="gengxin">2018-12-02更新</span>
	    					<img src="../images/phone.png"  class="gm-phone-icon"/>
	    				</div>
	    			</a>
	    		</li>-->
	    	</ul>
	    	<!--下拉刷新容器-->
		    <div id="pullrefresh" class="newslist w620 mui-scroll-wrapper" style="position: static;">
				<!--数据列表-->
			    <div class="mui-scroll conferDiv">
			    	  <ul class="gm-goods-list">
				    	  	<!--<li>
				    	  		<a data-href="shangpininfo.html">
				    	  			<img src="../images/goods.png" />
				    	  			<h1>夏凉拖鞋</h1>
				    	  			<p>￥46.66</p>
				    	  			<p>46.66积分</p>
				    	  		</a>
				    	  	</li>
				    	  	-->
			    	  </ul>
			    </div>
			</div>
		</div>
		
		<script type="text/javascript">	
		mui("footer").on("tap","a",function(){
			location.href=$(this).attr("data-href");
//			mui.openWindow({url:$(this).attr("data-href")})
		})			
		mui(".mui-content").on("tap","a",function(){
			mui.openWindow({url:$(this).attr("data-href")})
		})
		mui(".store-list").on("tap",".gm-phone-icon",function(){
//			mui.openWindow({url:$(this).attr("data-href")})
            location.href=$(this).attr("data-href");
		})
		var page=1;	
		var $height = $(window).height();
		var $height1 = $("header").height();
 	    $(".mui-scroll-wrapper").height( $height - $height1 );
		mui.init({
			pullRefresh: {
				container: '#pullrefresh',
				down: {
					style:'circle',
					callback: pulldownRefresh
				},
				up: {
					contentrefresh: '正在加载...',
					callback: pullupRefresh
				}
			}
		});
		/**
		 * 下拉刷新具体业务实现
		 */
		function pulldownRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPulldownToRefresh()
				getContents()
			}, 1500)
		}
		/**
		 * 上拉加载具体业务实现
		 */
		function pullupRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPullupToRefresh() //参数为true代表没有更多数据了。
				getContents()
			}, 1500)
		}
		mui(".mui-content").on("tap","a[data-href]",function(){
			mui.openWindow({url:$(this).attr("data-href")})
		})
		mui(".store-list").on("tap",".gm-phone-icon",function(){
//			mui.openWindow({url:$(this).attr("data-href")})
            location.href=$(this).attr("data-href");
		})
		var param = {}
		var id=getQueryString("id");
		param.id=id;
		//获取商品列表
		$.post(net+"/public/index.php?s=api/shop/store_goods/",param,function(res){
			if(res.code=="200"){
				var str="";
				var src=net+"public/uploads/home/store/"+id+"/"+res.result.store_avatar
				str='<li style="border-bottom:none;"><a><img  src="'+src+'"/><div class="store-con"><h1 class="only-line">'+res.result.store_name+'</h1><button class="yirenzheng">已认证</button><img src="../images/phone.png" data-href="tel://'+res.result.store_phone
				+'"  class="gm-phone-icon"/></div></a></li>'
	    		$(".store-list").html(str);	

			}
		})	
			
	
	
		
		function getContents(){
		     //		    读取列表
            data={};
            data.id=getQueryString("id");
            data.page=page;
			$.post(net+"/public/index.php?s=api/shop/getStoreGoodlist/",data,function(data){
               if(data.code==200){
	               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
	               		var str="";
	               		$.each(data.result, function(i,value) {
	               			var src=net+"public/uploads/home/store/goods/"+this.store_id+"/"+this.goods_image;
	               	   	    str+='<li ><a data-href="shangpininfo.html?id='+this.goods_id+'"><img src="'+src+'" /><h1 class="only-line">'+this.goods_name+'</h1><p>￥'+this.goods_price+'</p><p>'+this.goods_point+'积分</p></a><img class="gwc-tb" src="../images/gwc-icon_03.png"></li>'
	               		});
	               	   $(".gm-goods-list").append(str);
	               	   page++;
	               	}else{
	               		mui.toast("没有更多数据")
	               	}
	               	
               }
			   },'json'
			)
		}
		getContents();



		</script>
	</body>

</html>